import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    user: JSON.parse(localStorage.getItem('USER_TOKEN'))
  },
  getters: {
  },
  //同步数据处理
  mutations: {
    setUser(state, data) {
      state.user = data
      localStorage.setItem('USER_TOKEN', JSON.stringify(data))
    }
  },
  //异步数据处理
  actions: {
  },
  modules: {
  }
})
